<?php
/*
Template Name: Links
*/
?>
 
<?php get_header(); ?>

<div id="wrapper">
	<div id="container" class="narrowcolumn">
		<div id="content">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

			<div id="post-<?php the_ID(); ?>" class="post">
				<h2 id="post-title-<?php the_ID(); ?>" class="post-title"><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
				<div id="post-entry-<?php the_ID(); ?>" class="post-entry">
					<?php the_content('<span class="more">(Continued)</span>'); ?>
<?php
	$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
	foreach ($link_cats as $link_cat) {
?>
					<p style="margin-bottom:0;font-weight:bold;"><?php echo $link_cat->cat_name; ?></p>
					<ul id="linkcat-<?php echo $link_cat->cat_id; ?>" style="margin-top:0;">
					<?php get_links($link_cat->cat_id, '<li>', '</li>', ' &mdash; ', FALSE, '', TRUE, FALSE, -1, TRUE); ?>
					</ul>
<?php } ?>
					<?php edit_post_link('Edit this page.', '<p>', '</p>'); ?>
				</div><!-- END POST-ENTRY -->
				<!--<?php trackback_rdf(); ?>-->
			</div><!-- END POST -->

<?php endwhile; endif; ?>

		</div><!-- END CONTENT -->
	</div><!-- END CONTAINER -->

<?php get_sidebar(); ?>

</div><!-- END WRAPPER -->

<?php get_footer(); ?>